<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2021/3/25
  Time: 11:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ page import="com.web.bean.novel.Novel" %>
<%@ page import="com.web.bean.category.Category" %>
<%@ page import="com.web.dao.novel.NovelDao" %>
<%@ page import="com.web.dao.novel.NovelDaoImpl" %>
<%@ page import="java.util.List" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title>小说编辑发布界面</title>
    <script type="text/javascript" src="js/jquery-1.10.1.js"></script>
    <link rel="stylesheet" type="text/css" href="css/edit.css">
    <link rel="stylesheet" type="text/css" href="css/wangEditor.min.css">
    <script type="text/javascript" src="js/wangEditor.min.js"></script>
</head>

<body>
<%
    request.setCharacterEncoding("utf-8");
    Category cls=new Category();
    Novel novel=new Novel();
    NovelDaoImpl novelDao=new NovelDaoImpl();
    if("fabu".equals(request.getParameter("action")))
    {
        novel.setNid(request.getParameter("nid"));
        novel.setSynopsis(request.getParameter("content"));
        novel.setNname(request.getParameter("nname"));
        novel.setUid(request.getParameter("uid"));
        novel.setNcount(Integer.parseInt(request.getParameter("ncount")));
        novel.setImgsrc(request.getParameter("imgsrc"));
        novel.setCategory(request.getParameter("category"));
        novel.setCode(request.getParameter("code"));
        novelDao.addNovel(novel);
        System.out.println("<script>alert('发布成功');</script>");
    }
%>
<div class="header">
    <h2>当前位置：小说编辑</h2>
</div>

<div class="context" >
    <form id="form1" name="form1" method="post"
          action="novel/novel-edit.jsp?action=fabu" onsubmit="return check(this)">
        <table>
            
            <tr>
                <td>小  说   标   题:</td>
                <td><input type="text" name="txtTitle" id="txtTitle" style="width:500px;height:30px"/></td>
            </tr>

            <tr>
                <td>小  说   内   容:</td>
                <td style="width:1000px;"><textarea rows="25" name="content" id="content"></textarea> </td>
            </tr>

            <tr>
                <td colspan="2" class="inp">
                    <input class="submit" type="submit" name="button" id="button" value="提交" style="color:#FFFFFF"/>
                    <input class="submit" type="reset" name="button2" id="button2" value="重置"style="color:#FFFFFF" />
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
<script type="text/javascript">
    var editor = new wangEditor('content');
    editor.config.menus = [
        'bold',
        'underline',
        'italic',
        'strikethrough',
        'eraser',
        'forecolor',
        'bgcolor',
        '|',
        'link',
        'unlink',
        'table',
        'emotion',
        '|',
        'img',
        'video',
        'location',
    ];

    editor.create();
</script>
</html>
